package com.ews.onlineexchange.model;

import java.math.BigDecimal;

import javax.persistence.Entity;
import javax.persistence.ManyToOne;
import javax.persistence.PreUpdate;
import javax.validation.constraints.NotNull;

@Entity
public class OfferPrice extends DataEntity {

	/**
	 * 
	 */
	private static final long	serialVersionUID	= 1L;

	private BigDecimal			newMaxOffer;
	private Trade				trade;


	@NotNull
	public BigDecimal getNewMaxOffer() {
		return newMaxOffer;
	}

	public void setNewMaxOffer( BigDecimal newMaxOffer ) {
		this.newMaxOffer = newMaxOffer;
	}

	@NotNull
	@ManyToOne
	public Trade getTrade() {
		return trade;
	}

	public void setTrade( Trade trade ) {
		this.trade = trade;
	}
	
	@PreUpdate
	public void preUpdate() {
		throw new RuntimeException("Cannot update OfferPrice instance.");
	}

}
